home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / MacTCP.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  21.1 KB  |  834 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        MacTCP.p
  3.  
  4.      Contains:    TCP Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacTCP 2.0.6
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT MacTCP;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __MACTCP__}
  28. {$SETC __MACTCP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC MacTCPIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __MACTYPES__}
  35. {$I MacTypes.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MIXEDMODE__}
  38. {$I MixedMode.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __APPLETALK__}
  41. {$I AppleTalk.p}
  42. {$ENDC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49. {
  50. Developer Notes:
  51.         0. This MacTCP header replaces what used to be defined in the following header files
  52.             MacTCPCommonTypes.h
  53.             GetMyIPAddr.h
  54.             MiscIPPB.h
  55.             TCPPB.h
  56.             UDPPB.h 
  57.             
  58.             When the various control calls are made to the ip driver, you must set up a 
  59.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  60.             Otherwise, the 68K driver code, will not correctly call your routine.
  61.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  62.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  63.             the ioCompletion parameter.
  64.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  65.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  66.             to pass in the ioCompletion field of the parameter block.
  67.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  68.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  69.             of the parameter block
  70.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  71.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  72.             universal procptr to pass in the ioCompletion field of the paramter
  73.             block.
  74.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  75.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  76.             of the parameter block
  77.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  78.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  79.             universal procptr to pass in the ioCompletion field of the paramter
  80.             block.
  81.         7. For all calls implementing a notifyProc or ioCompletion routine
  82.             which was set up using a NewTCPRoutineProc call, do not call
  83.             DisposeRoutineSDescriptor on the universal procptr until
  84.             after the completion or notify proc has completed.
  85. }
  86.  
  87. { MacTCP return Codes in the range -23000 through -23049 }
  88.  
  89. CONST
  90.     inProgress                    = 1;                            {  I/O in progress  }
  91.     ipBadLapErr                    = -23000;                        {  bad network configuration  }
  92.     ipBadCnfgErr                = -23001;                        {  bad IP configuration error  }
  93.     ipNoCnfgErr                    = -23002;                        {  missing IP or LAP configuration error  }
  94.     ipLoadErr                    = -23003;                        {  error in MacTCP load  }
  95.     ipBadAddr                    = -23004;                        {  error in getting address  }
  96.     connectionClosing            = -23005;                        {  connection is closing  }
  97.     invalidLength                = -23006;
  98.     connectionExists            = -23007;                        {  request conflicts with existing connection  }
  99.     connectionDoesntExist        = -23008;                        {  connection does not exist  }
  100.     insufficientResources        = -23009;                        {  insufficient resources to perform request  }
  101.     invalidStreamPtr            = -23010;
  102.     streamAlreadyOpen            = -23011;
  103.     connectionTerminated        = -23012;
  104.     invalidBufPtr                = -23013;
  105.     invalidRDS                    = -23014;
  106.     invalidWDS                    = -23014;
  107.     openFailed                    = -23015;
  108.     commandTimeout                = -23016;
  109.     duplicateSocket                = -23017;
  110.  
  111. { Error codes from internal IP functions }
  112.     ipDontFragErr                = -23032;                        {  Packet too large to send w/o fragmenting  }
  113.     ipDestDeadErr                = -23033;                        {  destination not responding  }
  114.     icmpEchoTimeoutErr            = -23035;                        {  ICMP echo timed-out  }
  115.     ipNoFragMemErr                = -23036;                        {  no memory to send fragmented pkt  }
  116.     ipRouteErr                    = -23037;                        {  can't route packet off-net  }
  117.     nameSyntaxErr                = -23041;
  118.     cacheFault                    = -23042;
  119.     noResultProc                = -23043;
  120.     noNameServer                = -23044;
  121.     authNameErr                    = -23045;
  122.     noAnsErr                    = -23046;
  123.     dnrErr                        = -23047;
  124.     outOfMemory                    = -23048;
  125.  
  126.  
  127.     BYTES_16WORD                = 2;                            {  bytes per = 16, bit ip word  }
  128.     BYTES_32WORD                = 4;                            {  bytes per = 32, bit ip word  }
  129.     BYTES_64WORD                = 8;                            {  bytes per = 64, bit ip word  }
  130.  
  131. { 8-bit quantity }
  132.  
  133. TYPE
  134.     b_8                                    = UInt8;
  135. { 16-bit quantity }
  136.     b_16                                = UInt16;
  137. { 32-bit quantity }
  138.     b_32                                = UInt32;
  139. { IP address is 32-bits }
  140.     ip_addr                                = b_32;
  141.     ip_addrbytesPtr = ^ip_addrbytes;
  142.     ip_addrbytes = RECORD
  143.         CASE INTEGER OF
  144.         0: (
  145.             addr:                b_32;
  146.             );
  147.         1: (
  148.             byte:                PACKED ARRAY [0..3] OF UInt8;
  149.             );
  150.     END;
  151.  
  152.     wdsEntryPtr = ^wdsEntry;
  153.     wdsEntry = RECORD
  154.         length:                    UInt16;                                    {  length of buffer  }
  155.         ptr:                    Ptr;                                    {  pointer to buffer  }
  156.     END;
  157.  
  158.     rdsEntryPtr = ^rdsEntry;
  159.     rdsEntry = RECORD
  160.         length:                    UInt16;                                    {  length of buffer  }
  161.         ptr:                    Ptr;                                    {  pointer to buffer  }
  162.     END;
  163.  
  164.     BufferPtr                            = UInt32;
  165.     StreamPtr                            = UInt32;
  166.  
  167. CONST
  168.     netUnreach                    = 0;
  169.     hostUnreach                    = 1;
  170.     protocolUnreach                = 2;
  171.     portUnreach                    = 3;
  172.     fragReqd                    = 4;
  173.     sourceRouteFailed            = 5;
  174.     timeExceeded                = 6;
  175.     parmProblem                    = 7;
  176.     missingOption                = 8;
  177.     lastICMPMsgType                = 32767;
  178.  
  179.  
  180. TYPE
  181.     ICMPMsgType                            = UInt16;
  182.     ip_port                                = b_16;
  183.     ICMPReportPtr = ^ICMPReport;
  184.     ICMPReport = RECORD
  185.         streamPtr:                StreamPtr;
  186.         localHost:                ip_addr;
  187.         localPort:                ip_port;
  188.         remoteHost:                ip_addr;
  189.         remotePort:                ip_port;
  190.         reportType:                INTEGER;
  191.         optionalAddlInfo:        UInt16;
  192.         optionalAddlInfoPtr:    UInt32;
  193.     END;
  194.  
  195. { csCode to get our IP address }
  196.  
  197. CONST
  198.     ipctlGetAddr                = 15;
  199.  
  200.  
  201. TYPE
  202.     GetAddrParamBlockPtr = ^GetAddrParamBlock;
  203. {$IFC TYPED_FUNCTION_POINTERS}
  204.     GetIPIOCompletionProcPtr = PROCEDURE(VAR iopb: GetAddrParamBlock); C;
  205. {$ELSEC}
  206.     GetIPIOCompletionProcPtr = ProcPtr;
  207. {$ENDC}
  208.  
  209.     GetIPIOCompletionUPP = UniversalProcPtr;
  210.     GetAddrParamBlock = RECORD
  211.         qLink:                    QElemPtr;
  212.         qType:                    INTEGER;
  213.         ioTrap:                    INTEGER;
  214.         ioCmdAddr:                Ptr;
  215.         ioCompletion:            GetIPIOCompletionUPP;
  216.         ioResult:                OSErr;
  217.         ioNamePtr:                StringPtr;
  218.         ioVRefNum:                INTEGER;
  219.         ioCRefNum:                INTEGER;
  220.         csCode:                    INTEGER;
  221.         ourAddress:                ip_addr;                                {  our IP address  }
  222.         ourNetMask:                LONGINT;                                {  our IP net mask  }
  223.     END;
  224.  
  225. { control codes }
  226.  
  227. CONST
  228.     ipctlEchoICMP                = 17;                            {  send icmp echo  }
  229.     ipctlLAPStats                = 19;                            {  get lap stats  }
  230.  
  231.  
  232.  
  233. TYPE
  234.     ICMPParamBlockPtr = ^ICMPParamBlock;
  235. {$IFC TYPED_FUNCTION_POINTERS}
  236.     IPIOCompletionProcPtr = PROCEDURE(VAR iopb: ICMPParamBlock); C;
  237. {$ELSEC}
  238.     IPIOCompletionProcPtr = ProcPtr;
  239. {$ENDC}
  240.  
  241.     IPIOCompletionUPP = UniversalProcPtr;
  242.     ICMPParamBlock = RECORD
  243.         qLink:                    QElemPtr;
  244.         qType:                    INTEGER;
  245.         ioTrap:                    INTEGER;
  246.         ioCmdAddr:                Ptr;
  247.         ioCompletion:            IPIOCompletionUPP;
  248.         ioResult:                OSErr;
  249.         ioNamePtr:                StringPtr;
  250.         ioVRefNum:                INTEGER;
  251.         ioCRefNum:                INTEGER;
  252.         csCode:                    INTEGER;
  253.         params:                    ARRAY [0..10] OF INTEGER;
  254.         echoRequestOut:            UInt32;                                    {  time in ticks of when the echo request went out  }
  255.         echoReplyIn:            UInt32;                                    {  time in ticks of when the reply was received  }
  256.         echoedData:                rdsEntry;                                {  data received in responce  }
  257.         options:                Ptr;
  258.         userDataPtr:            UInt32;
  259.     END;
  260.  
  261. {$IFC TYPED_FUNCTION_POINTERS}
  262.     ICMPEchoNotifyProcPtr = PROCEDURE(VAR iopb: ICMPParamBlock); C;
  263. {$ELSEC}
  264.     ICMPEchoNotifyProcPtr = ProcPtr;
  265. {$ENDC}
  266.  
  267.     ICMPEchoNotifyUPP = UniversalProcPtr;
  268.     LAPStatsPtr = ^LAPStats;
  269.     IPParamBlockPtr = ^IPParamBlock;
  270.     IPParamBlock = RECORD
  271.         qLink:                    QElemPtr;
  272.         qType:                    INTEGER;
  273.         ioTrap:                    INTEGER;
  274.         ioCmdAddr:                Ptr;
  275.         ioCompletion:            IPIOCompletionUPP;
  276.         ioResult:                OSErr;
  277.         ioNamePtr:                StringPtr;
  278.         ioVRefNum:                INTEGER;
  279.         ioCRefNum:                INTEGER;
  280.         csCode:                    INTEGER;
  281.         CASE INTEGER OF
  282.         0: (
  283.             dest:                ip_addr;                                {  echo to IP address  }
  284.             data:                wdsEntry;
  285.             timeout:            INTEGER;
  286.             options:            Ptr;
  287.             optLength:            UInt16;
  288.             icmpCompletion:        ICMPEchoNotifyUPP;
  289.             userDataPtr:        UInt32;
  290.            );
  291.         1: (
  292.             lapStatsPtr:        LAPStatsPtr;
  293.            );
  294.     END;
  295.  
  296.  
  297.     nbp_entryPtr = ^nbp_entry;
  298.     nbp_entry = RECORD
  299.         ip_address:                ip_addr;                                {  IP address  }
  300.         at_address:                AddrBlock;                                {  matching AppleTalk address  }
  301.         gateway:                BOOLEAN;                                {  TRUE if entry for a gateway  }
  302.         valid:                    BOOLEAN;                                {  TRUE if LAP address is valid  }
  303.         probing:                BOOLEAN;                                {  TRUE if NBP lookup pending  }
  304.         afiller:                SInt8;                                    {  Filler for proper byte alignment      }
  305.         age:                    LONGINT;                                {  ticks since cache entry verified  }
  306.         access:                    LONGINT;                                {  ticks since last access  }
  307.         filler:                    ARRAY [0..115] OF SInt8;                {  for internal use only !!!  }
  308.     END;
  309.  
  310.     Enet_addrPtr = ^Enet_addr;
  311.     Enet_addr = RECORD
  312.         en_hi:                    b_16;
  313.         en_lo:                    b_32;
  314.     END;
  315.  
  316.     arp_entryPtr = ^arp_entry;
  317.     arp_entry = RECORD
  318.         age:                    INTEGER;                                {  cache aging field  }
  319.         protocol:                b_16;                                    {  Protocol type  }
  320.         ip_address:                ip_addr;                                {  IP address  }
  321.         en_address:                Enet_addr;                                {  matching Ethernet address  }
  322.     END;
  323.  
  324.     LAPStatsAddrXlationPtr = ^LAPStatsAddrXlation;
  325.     LAPStatsAddrXlation = RECORD
  326.         CASE INTEGER OF
  327.         0: (
  328.             arp_table:            arp_entryPtr;
  329.             );
  330.         1: (
  331.             nbp_table:            nbp_entryPtr;
  332.             );
  333.     END;
  334.  
  335.     LAPStats = RECORD
  336.         ifType:                    INTEGER;
  337.         ifString:                CStringPtr;
  338.         ifMaxMTU:                INTEGER;
  339.         ifSpeed:                LONGINT;
  340.         ifPhyAddrLength:        INTEGER;
  341.         ifPhysicalAddress:        CStringPtr;
  342.         AddrXlation:            LAPStatsAddrXlation;
  343.         slotNumber:                INTEGER;
  344.     END;
  345.  
  346. { number of ARP table entries }
  347.  
  348. CONST
  349.     ARP_TABLE_SIZE                = 20;
  350.  
  351.     NBP_TABLE_SIZE                = 20;                            {  number of NBP table entries  }
  352.     NBP_MAX_NAME_SIZE            = 28;
  353.  
  354.  
  355.  
  356. { Command codes }
  357.     TCPCreate                    = 30;
  358.     TCPPassiveOpen                = 31;
  359.     TCPActiveOpen                = 32;
  360.     TCPSend                        = 34;
  361.     TCPNoCopyRcv                = 35;
  362.     TCPRcvBfrReturn                = 36;
  363.     TCPRcv                        = 37;
  364.     TCPClose                    = 38;
  365.     TCPAbort                    = 39;
  366.     TCPStatus                    = 40;
  367.     TCPExtendedStat                = 41;
  368.     TCPRelease                    = 42;
  369.     TCPGlobalInfo                = 43;
  370.     TCPCtlMax                    = 49;
  371.  
  372.     TCPClosing                    = 1;
  373.     TCPULPTimeout                = 2;
  374.     TCPTerminate                = 3;
  375.     TCPDataArrival                = 4;
  376.     TCPUrgent                    = 5;
  377.     TCPICMPReceived                = 6;
  378.     lastEvent                    = 32767;
  379.  
  380.  
  381. TYPE
  382.     TCPEventCode                        = UInt16;
  383.  
  384. CONST
  385.     TCPRemoteAbort                = 2;
  386.     TCPNetworkFailure            = 3;
  387.     TCPSecPrecMismatch            = 4;
  388.     TCPULPTimeoutTerminate        = 5;
  389.     TCPULPAbort                    = 6;
  390.     TCPULPClose                    = 7;
  391.     TCPServiceError                = 8;
  392.     lastReason                    = 32767;
  393.  
  394.  
  395. TYPE
  396.     TCPTerminationReason                = UInt16;
  397. {$IFC TYPED_FUNCTION_POINTERS}
  398.     TCPNotifyProcPtr = PROCEDURE(tcpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; terminReason: UInt16; VAR icmpMsg: ICMPReport);
  399. {$ELSEC}
  400.     TCPNotifyProcPtr = ProcPtr;
  401. {$ENDC}
  402.  
  403.     TCPNotifyUPP = UniversalProcPtr;
  404.     tcp_port                            = UInt16;
  405. { ValidityFlags }
  406.  
  407. CONST
  408.     timeoutValue                = $80;
  409.     timeoutAction                = $40;
  410.     typeOfService                = $20;
  411.     precedence                    = $10;
  412.  
  413. { TOSFlags }
  414.     lowDelay                    = $01;
  415.     throughPut                    = $02;
  416.     reliability                    = $04;
  417.  
  418.  
  419. TYPE
  420.     TCPCreatePBPtr = ^TCPCreatePB;
  421.     TCPCreatePB = RECORD
  422.         rcvBuff:                Ptr;
  423.         rcvBuffLen:                UInt32;
  424.         notifyProc:                TCPNotifyUPP;
  425.         userDataPtr:            Ptr;
  426.     END;
  427.  
  428.     TCPOpenPBPtr = ^TCPOpenPB;
  429.     TCPOpenPB = RECORD
  430.         ulpTimeoutValue:        SInt8;
  431.         ulpTimeoutAction:        SInt8;
  432.         validityFlags:            SInt8;
  433.         commandTimeoutValue:    SInt8;
  434.         remoteHost:                ip_addr;
  435.         remotePort:                tcp_port;
  436.         localHost:                ip_addr;
  437.         localPort:                tcp_port;
  438.         tosFlags:                SInt8;
  439.         precedence:                SInt8;
  440.         dontFrag:                BOOLEAN;
  441.         timeToLive:                SInt8;
  442.         security:                SInt8;
  443.         optionCnt:                SInt8;
  444.         options:                ARRAY [0..39] OF SInt8;
  445.         userDataPtr:            Ptr;
  446.     END;
  447.  
  448.  
  449.     TCPSendPBPtr = ^TCPSendPB;
  450.     TCPSendPB = RECORD
  451.         ulpTimeoutValue:        SInt8;
  452.         ulpTimeoutAction:        SInt8;
  453.         validityFlags:            SInt8;
  454.         pushFlag:                BOOLEAN;
  455.         urgentFlag:                BOOLEAN;
  456.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  457.         wdsPtr:                    Ptr;
  458.         sendFree:                UInt32;
  459.         sendLength:                UInt16;
  460.         userDataPtr:            Ptr;
  461.     END;
  462.  
  463.  
  464. { for receive and return rcv buff calls }
  465. {   Note: the filler in the following structure is in a different location than }
  466. {         that specified in the Programmer's Guide.  }
  467.     TCPReceivePBPtr = ^TCPReceivePB;
  468.     TCPReceivePB = RECORD
  469.         commandTimeoutValue:    SInt8;
  470.         markFlag:                BOOLEAN;
  471.         urgentFlag:                BOOLEAN;
  472.         filler:                    SInt8;                                    {  Filler for proper byte alignment   }
  473.         rcvBuff:                Ptr;
  474.         rcvBuffLen:                UInt16;
  475.         rdsPtr:                    Ptr;
  476.         rdsLength:                UInt16;
  477.         secondTimeStamp:        UInt16;
  478.         userDataPtr:            Ptr;
  479.     END;
  480.  
  481.  
  482.     TCPClosePBPtr = ^TCPClosePB;
  483.     TCPClosePB = RECORD
  484.         ulpTimeoutValue:        SInt8;
  485.         ulpTimeoutAction:        SInt8;
  486.         validityFlags:            SInt8;
  487.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  488.         userDataPtr:            Ptr;
  489.     END;
  490.  
  491.     HistoBucketPtr = ^HistoBucket;
  492.     HistoBucket = RECORD
  493.         value:                    UInt16;
  494.         counter:                UInt32;
  495.     END;
  496.  
  497.  
  498. CONST
  499.     NumOfHistoBuckets            = 7;
  500.  
  501.  
  502. TYPE
  503.     TCPConnectionStatsPtr = ^TCPConnectionStats;
  504.     TCPConnectionStats = RECORD
  505.         dataPktsRcvd:            UInt32;
  506.         dataPktsSent:            UInt32;
  507.         dataPktsResent:            UInt32;
  508.         bytesRcvd:                UInt32;
  509.         bytesRcvdDup:            UInt32;
  510.         bytesRcvdPastWindow:    UInt32;
  511.         bytesSent:                UInt32;
  512.         bytesResent:            UInt32;
  513.         numHistoBuckets:        UInt16;
  514.         sentSizeHisto:            ARRAY [0..6] OF HistoBucket;
  515.         lastRTT:                UInt16;
  516.         tmrSRTT:                UInt16;
  517.         rttVariance:            UInt16;
  518.         tmrRTO:                    UInt16;
  519.         sendTries:                SInt8;
  520.         sourchQuenchRcvd:        SInt8;
  521.     END;
  522.  
  523.     TCPStatusPBPtr = ^TCPStatusPB;
  524.     TCPStatusPB = RECORD
  525.         ulpTimeoutValue:        SInt8;
  526.         ulpTimeoutAction:        SInt8;
  527.         unused:                    LONGINT;
  528.         remoteHost:                ip_addr;
  529.         remotePort:                tcp_port;
  530.         localHost:                ip_addr;
  531.         localPort:                tcp_port;
  532.         tosFlags:                SInt8;
  533.         precedence:                SInt8;
  534.         connectionState:        SInt8;
  535.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  536.         sendWindow:                UInt16;
  537.         rcvWindow:                UInt16;
  538.         amtUnackedData:            UInt16;
  539.         amtUnreadData:            UInt16;
  540.         securityLevelPtr:        Ptr;
  541.         sendUnacked:            UInt32;
  542.         sendNext:                UInt32;
  543.         congestionWindow:        UInt32;
  544.         rcvNext:                UInt32;
  545.         srtt:                    UInt32;
  546.         lastRTT:                UInt32;
  547.         sendMaxSegSize:            UInt32;
  548.         connStatPtr:            TCPConnectionStatsPtr;
  549.         userDataPtr:            Ptr;
  550.     END;
  551.  
  552.     TCPAbortPBPtr = ^TCPAbortPB;
  553.     TCPAbortPB = RECORD
  554.         userDataPtr:            Ptr;
  555.     END;
  556.  
  557.     TCPParamPtr = ^TCPParam;
  558.     TCPParam = RECORD
  559.         tcpRtoA:                UInt32;
  560.         tcpRtoMin:                UInt32;
  561.         tcpRtoMax:                UInt32;
  562.         tcpMaxSegSize:            UInt32;
  563.         tcpMaxConn:                UInt32;
  564.         tcpMaxWindow:            UInt32;
  565.     END;
  566.  
  567.     TCPStatsPtr = ^TCPStats;
  568.     TCPStats = RECORD
  569.         tcpConnAttempts:        UInt32;
  570.         tcpConnOpened:            UInt32;
  571.         tcpConnAccepted:        UInt32;
  572.         tcpConnClosed:            UInt32;
  573.         tcpConnAborted:            UInt32;
  574.         tcpOctetsIn:            UInt32;
  575.         tcpOctetsOut:            UInt32;
  576.         tcpOctetsInDup:            UInt32;
  577.         tcpOctetsRetrans:        UInt32;
  578.         tcpInputPkts:            UInt32;
  579.         tcpOutputPkts:            UInt32;
  580.         tcpDupPkts:                UInt32;
  581.         tcpRetransPkts:            UInt32;
  582.     END;
  583.  
  584.     StreamPPtr                            = ^StreamPtr;
  585.     TCPGlobalInfoPBPtr = ^TCPGlobalInfoPB;
  586.     TCPGlobalInfoPB = RECORD
  587.         tcpParamPtr:            TCPParamPtr;
  588.         tcpStatsPtr:            TCPStatsPtr;
  589.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  590.         userDataPtr:            Ptr;
  591.         maxTCPConnections:        UInt16;
  592.     END;
  593.  
  594.     TCPiopbPtr = ^TCPiopb;
  595. {$IFC TYPED_FUNCTION_POINTERS}
  596.     TCPIOCompletionProcPtr = PROCEDURE(VAR iopb: TCPiopb); C;
  597. {$ELSEC}
  598.     TCPIOCompletionProcPtr = ProcPtr;
  599. {$ENDC}
  600.  
  601.     TCPIOCompletionUPP = UniversalProcPtr;
  602.     TCPiopb = RECORD
  603.         fill12:                    ARRAY [0..11] OF SInt8;
  604.         ioCompletion:            TCPIOCompletionUPP;
  605.         ioResult:                INTEGER;
  606.         ioNamePtr:                Ptr;
  607.         ioVRefNum:                INTEGER;
  608.         ioCRefNum:                INTEGER;
  609.         csCode:                    INTEGER;
  610.         tcpStream:                StreamPtr;
  611.         CASE INTEGER OF
  612.         0: (
  613.             create:                TCPCreatePB;
  614.             );
  615.         1: (
  616.             open:                TCPOpenPB;
  617.             );
  618.         2: (
  619.             send:                TCPSendPB;
  620.             );
  621.         3: (
  622.             receive:            TCPReceivePB;
  623.             );
  624.         4: (
  625.             close:                TCPClosePB;
  626.             );
  627.         5: (
  628.             abort:                TCPAbortPB;
  629.             );
  630.         6: (
  631.             status:                TCPStatusPB;
  632.             );
  633.         7: (
  634.             globalInfo:            TCPGlobalInfoPB;
  635.             );
  636.     END;
  637.  
  638.  
  639. CONST
  640.     UDPCreate                    = 20;
  641.     UDPRead                        = 21;
  642.     UDPBfrReturn                = 22;
  643.     UDPWrite                    = 23;
  644.     UDPRelease                    = 24;
  645.     UDPMaxMTUSize                = 25;
  646.     UDPStatus                    = 26;
  647.     UDPMultiCreate                = 27;
  648.     UDPMultiSend                = 28;
  649.     UDPMultiRead                = 29;
  650.     UDPCtlMax                    = 29;
  651.  
  652.     UDPDataArrival                = 1;
  653.     UDPICMPReceived                = 2;
  654.     lastUDPEvent                = 32767;
  655.  
  656.  
  657. TYPE
  658.     UDPEventCode                        = UInt16;
  659. {$IFC TYPED_FUNCTION_POINTERS}
  660.     UDPNotifyProcPtr = PROCEDURE(udpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; VAR icmpMsg: ICMPReport);
  661. {$ELSEC}
  662.     UDPNotifyProcPtr = ProcPtr;
  663. {$ENDC}
  664.  
  665.     UDPNotifyUPP = UniversalProcPtr;
  666.     udp_port                            = UInt16;
  667. { for create and release calls }
  668.     UDPCreatePBPtr = ^UDPCreatePB;
  669.     UDPCreatePB = RECORD
  670.         rcvBuff:                Ptr;
  671.         rcvBuffLen:                UInt32;
  672.         notifyProc:                UDPNotifyUPP;
  673.         localPort:                UInt16;
  674.         userDataPtr:            Ptr;
  675.         endingPort:                udp_port;
  676.     END;
  677.  
  678.     UDPSendPBPtr = ^UDPSendPB;
  679.     UDPSendPB = RECORD
  680.         reserved:                UInt16;
  681.         remoteHost:                ip_addr;
  682.         remotePort:                udp_port;
  683.         wdsPtr:                    Ptr;
  684.         checkSum:                BOOLEAN;
  685.         filler:                    SInt8;                                    {  Filler for proper byte alignment      }
  686.         sendLength:                UInt16;
  687.         userDataPtr:            Ptr;
  688.         localPort:                udp_port;
  689.     END;
  690.  
  691. { for receive and buffer return calls }
  692.     UDPReceivePBPtr = ^UDPReceivePB;
  693.     UDPReceivePB = RECORD
  694.         timeOut:                UInt16;
  695.         remoteHost:                ip_addr;
  696.         remotePort:                udp_port;
  697.         rcvBuff:                Ptr;
  698.         rcvBuffLen:                UInt16;
  699.         secondTimeStamp:        UInt16;
  700.         userDataPtr:            Ptr;
  701.         destHost:                ip_addr;                                {  only for use with multi rcv  }
  702.         destPort:                udp_port;                                {  only for use with multi rcv  }
  703.     END;
  704.  
  705.     UDPMTUPBPtr = ^UDPMTUPB;
  706.     UDPMTUPB = RECORD
  707.         mtuSize:                UInt16;
  708.         remoteHost:                ip_addr;
  709.         userDataPtr:            Ptr;
  710.     END;
  711.  
  712.     UDPiopbPtr = ^UDPiopb;
  713. {$IFC TYPED_FUNCTION_POINTERS}
  714.     UDPIOCompletionProcPtr = PROCEDURE(VAR iopb: UDPiopb); C;
  715. {$ELSEC}
  716.     UDPIOCompletionProcPtr = ProcPtr;
  717. {$ENDC}
  718.  
  719.     UDPIOCompletionUPP = UniversalProcPtr;
  720.     UDPiopb = RECORD
  721.         fill12:                    ARRAY [0..11] OF SInt8;
  722.         ioCompletion:            UDPIOCompletionUPP;
  723.         ioResult:                INTEGER;
  724.         ioNamePtr:                Ptr;
  725.         ioVRefNum:                INTEGER;
  726.         ioCRefNum:                INTEGER;
  727.         csCode:                    INTEGER;
  728.         udpStream:                StreamPtr;
  729.         CASE INTEGER OF
  730.         0: (
  731.             create:                UDPCreatePB;
  732.             );
  733.         1: (
  734.             send:                UDPSendPB;
  735.             );
  736.         2: (
  737.             receive:            UDPReceivePB;
  738.             );
  739.         3: (
  740.             mtu:                UDPMTUPB;
  741.             );
  742.     END;
  743.  
  744.  
  745. CONST
  746.     uppGetIPIOCompletionProcInfo = $000000C1;
  747.     uppIPIOCompletionProcInfo = $000000C1;
  748.     uppICMPEchoNotifyProcInfo = $000000C1;
  749.     uppTCPNotifyProcInfo = $0000EEC0;
  750.     uppTCPIOCompletionProcInfo = $000000C1;
  751.     uppUDPNotifyProcInfo = $00003EC0;
  752.     uppUDPIOCompletionProcInfo = $000000C1;
  753.  
  754. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  755.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  756.     INLINE $2E9F;
  757.     {$ENDC}
  758.  
  759. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  760.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  761.     INLINE $2E9F;
  762.     {$ENDC}
  763.  
  764. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  765.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  766.     INLINE $2E9F;
  767.     {$ENDC}
  768.  
  769. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  770.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  771.     INLINE $2E9F;
  772.     {$ENDC}
  773.  
  774. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  775.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  776.     INLINE $2E9F;
  777.     {$ENDC}
  778.  
  779. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  780.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  781.     INLINE $2E9F;
  782.     {$ENDC}
  783.  
  784. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  785.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  786.     INLINE $2E9F;
  787.     {$ENDC}
  788.  
  789. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  790.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  791.     {To be implemented:  Glue to move parameters into registers.}
  792.     {$ENDC}
  793.  
  794. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  795.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  796.     {To be implemented:  Glue to move parameters into registers.}
  797.     {$ENDC}
  798.  
  799. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  800.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  801.     {To be implemented:  Glue to move parameters into registers.}
  802.     {$ENDC}
  803.  
  804. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; terminReason: UInt16; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  805.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  806.     INLINE $205F, $4E90;
  807.     {$ENDC}
  808.  
  809. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  810.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  811.     {To be implemented:  Glue to move parameters into registers.}
  812.     {$ENDC}
  813.  
  814. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: UInt16; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  815.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  816.     INLINE $205F, $4E90;
  817.     {$ENDC}
  818.  
  819. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  820.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  821.     {To be implemented:  Glue to move parameters into registers.}
  822.     {$ENDC}
  823.  
  824. {$ALIGN RESET}
  825. {$POP}
  826.  
  827. {$SETC UsingIncludes := MacTCPIncludes}
  828.  
  829. {$ENDC} {__MACTCP__}
  830.  
  831. {$IFC NOT UsingIncludes}
  832.  END.
  833. {$ENDC}
  834.